using System.Data;
using ET;
namespace DAL
{
    public class Contact_DAL
    {
        private readonly clsConnect cls = new clsConnect();

        #region Getdata
        public DataTable BindGirdtb_Contact(string keywords)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@KeyWords", keywords);
            return cls.GetData("sp_tb_Contact_Search");
        }
        public DataTable BindGirdtb_ContactDetail(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Contact_ID", id);
            return cls.GetData("sp_tb_Contact_Detail");
        }
        #endregion

        #region Insert
        public bool Inserttb_Contact(Contact_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Contact_Alias", data.Contact_Alias);
            cls.AddParameter("@Contact_Name", data.Contact_Name);
            cls.AddParameter("@Contact_BirthDay", data.Contact_BirthDay);
            cls.AddParameter("@Contact_Gender", data.Contact_Gender);
            cls.AddParameter("@Job_ID", data.Job_ID);
            cls.AddParameter("@Contact_Vocative", data.Contact_Vocative);
            cls.AddParameter("@Department_ID", data.Department_ID);
            cls.AddParameter("@Contact_Phone", data.Contact_Phone);
            cls.AddParameter("@Contact_MobilePhone", data.Contact_MobilePhone);
            cls.AddParameter("@Contact_Email", data.Contact_Email);
            cls.AddParameter("@Contact_Address", data.Contact_Address);
            cls.AddParameter("@District_ID", data.District_ID);
            cls.AddParameter("@Contact_Note", data.Contact_Note);
            cls.AddParameter("@Contact_User_Add", data.Contact_User_Add);
            cls.AddParameter("@Contact_Date_Add", data.Contact_Date_Add);
            cls.AddParameter("@Contact_Computer_Add", data.Contact_Computer_Add);
            return cls.ExecuteNonQuery("sp_tb_Contact_Insert");
        }
        #endregion

        #region Update
        public bool Updatetb_Contact(Contact_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Contact_ID", data.Contact_ID);
            cls.AddParameter("@Contact_Alias", data.Contact_Alias);
            cls.AddParameter("@Contact_Name", data.Contact_Name);
            cls.AddParameter("@Contact_BirthDay", data.Contact_BirthDay);
            cls.AddParameter("@Contact_Gender", data.Contact_Gender);
            cls.AddParameter("@Job_ID", data.Job_ID);
            cls.AddParameter("@Contact_Vocative", data.Contact_Vocative);
            cls.AddParameter("@Department_ID", data.Department_ID);
            cls.AddParameter("@Contact_Phone", data.Contact_Phone);
            cls.AddParameter("@Contact_MobilePhone", data.Contact_MobilePhone);
            cls.AddParameter("@Contact_Email", data.Contact_Email);
            cls.AddParameter("@Contact_Address", data.Contact_Address);
            cls.AddParameter("@District_ID", data.District_ID);
            cls.AddParameter("@Contact_Note", data.Contact_Note);
            cls.AddParameter("@Contact_User_Modify", data.Contact_User_Modify);
            cls.AddParameter("@Contact_Date_Modify", data.Contact_Date_Modify);
            cls.AddParameter("@Contact_Computer_Modify", data.Contact_Computer_Modify);
            return cls.ExecuteNonQuery("sp_tb_Contact_Update");
        }
        #endregion

        #region Delete
        public bool Deletetb_Contact(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Contact_ID", id);
            return cls.ExecuteNonQuery("sp_tb_Contact_Delete");
        }
        #endregion
    }
}